//
//  MyCertificateTableViewCell.m
//  WideHelp
//
//  Created by ENERGY on 2018/8/10.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "MyCertificateTableViewCell.h"

@interface MyCertificateTableViewCell()
@property (nonatomic, strong)UILabel * titleLab;
@property (nonatomic, strong)UILabel * timeLab;
@property (nonatomic, strong)UIButton * arrowBtn;
@property (nonatomic, strong)UIView * lineView;
@property (nonatomic, strong)NSString * helpID;
@end
@implementation MyCertificateTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor whiteColor];
        __weak typeof (self)weakSelf = self;
        [self.contentView addSubview:self.titleLab];
        [self.contentView addSubview:self.timeLab];
        [self.contentView addSubview:self.arrowBtn];
        [self.contentView addSubview:self.lineView];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(16/WIDTH_6_SCALE);
            make.top.equalTo(weakSelf.contentView.mas_top).mas_offset(15/WIDTH_6_SCALE);
            make.height.mas_offset(15/WIDTH_6_SCALE);
        }];
        [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.titleLab);
            make.top.equalTo(weakSelf.titleLab.mas_bottom).mas_offset(15/WIDTH_6_SCALE);
            make.height.mas_offset(13/WIDTH_6_SCALE);
        }];
        [self.arrowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.mas_right).mas_offset(-15/WIDTH_6_SCALE);
            make.centerY.equalTo(weakSelf.contentView.mas_centerY);
            make.width.mas_offset(7/WIDTH_6_SCALE);
            make.height.mas_offset(12/WIDTH_6_SCALE);
        }];
        [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(weakSelf.contentView);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
    }return self;
}
- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = DEF_FontSize_14;
        _titleLab.textColor = [UIColor blackColor];
        _titleLab.textAlignment = NSTextAlignmentLeft;
        _titleLab.text = @"意外互助计划";
    }return _titleLab;
}
- (UILabel *)timeLab{
    if (!_timeLab) {
        _timeLab = [[UILabel alloc] init];
        _timeLab.font = DEF_FontSize_14;
        _timeLab.textColor = [UIColor blackColor];
        _timeLab.textAlignment = NSTextAlignmentLeft;
        _timeLab.text = @"2018-01-01  15:22";
    }return _timeLab;
}
- (UIButton *)arrowBtn{
    if (!_arrowBtn) {
        _arrowBtn = [[UIButton alloc] init];
        [_arrowBtn setImage:[UIImage imageNamed:@"next_icon"] forState:UIControlStateNormal];
    }return _arrowBtn;
}
- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = getColor(@"eeeeee");
    }return _lineView;
}
- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.titleLab.text = model[@"helpname"];
    self.timeLab.text = model[@"join_time"];
    self.helpID = model[@"helpid"];
}
@end
